﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XNA_TD
{
    class FPS : IRunable, IUpdate
    {
        int fps;

        public FPS()
            : base(Priority.GUI)
        {
            fps = 0;
        }

        public void Update()
        {
            if (gameTime.ElapsedGameTime.Milliseconds != 0)
            {
                fps = (fps + 1000 / gameTime.ElapsedGameTime.Milliseconds) / 2;
                DebugInfo.Instance.add("FPS", fps);
            }
        }

        public override void Load()
        {
        }

        public override void UnLoad()
        {
            DebugInfo.Instance.remove("FPS");
        }
    }
}
